jQuery(document).ready(function() {
	
	jQuery('#getgadget2').click(function() {
		document.cookie="fb_gadget=" + jQuery('#phone_Name').text() + "; path=/"; 
		document.cookie="fb_price=" + jQuery('#phone_Price').text() + "; path=/"; 
	});
	
	jQuery('.compare-sku').click(function(){
	     
	     var sku = jQuery(".compare-sku").attr('id');
	     var maitainumbercompare = getCookie("fb_maitainumbercompare");

	     if(maitainumbercompare=="" || maitainumbercompare=="0") {
		document.cookie="fb_maitainumbercompare=" + "1" + "; path=/";
		document.cookie="fb_maitaicompare1=" + sku + "; path=/";
	     }

	     if(maitainumbercompare=="1") {
		var maitaicompare1 = getCookie("fb_maitaicompare1");
		if(maitaicompare1 != sku){
		  document.cookie="fb_maitainumbercompare=" + "2" + "; path=/";
		  document.cookie="fb_maitaicompare2=" + sku + "; path=/";
		}
		else
		  alert("The product is already in comaparison list.");
	     }
	     
	     if(maitainumbercompare=="2"){ 
		var maitaicompare1 = getCookie("fb_maitaicompare1");
		var maitaicompare2 = getCookie("fb_maitaicompare2");
		if(maitaicompare1 == sku || maitaicompare2 == sku)
		   alert("The product is already in comaparison list.");
		else
	           alert("The comparison list is full.");
	     } 
	       window.location=baseurl + "compare";
	     
		  
	});
	
	jQuery('#getgadget').click(function(){
		document.cookie="fb_imgsrc=" + jQuery("#spec-img").attr('src') + "; path=/";	
		document.cookie="fb_current_pos=" + "2" + "; path=/";
	});
	
	if(/specification/.test(self.location.href)){
	   var mode = getCookie("fb_mode");
       if(mode=="edit"){
		 jQuery('#getgadget2').text("Save");
       }
    }
	

});


function getCookie(fb_cname)
{
var name = fb_cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) 
  {
  var c = ca[i].replace(/\s/g, "");
  if (c.indexOf(name)==0) return c.substring(name.length,c.length);
  }
return "";
}